﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using FuzzyTaskList;
using System;
using System.IO;

namespace TestProject1
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class TasksTest
    {
        public TestContext TestContext { get; set; }

        private static TaskSet GetTaskData()
        {
            TaskSet tasks = new TaskSet();
            tasks.TaskCollection.Add(new FuzzyTaskItem("t1", 20, 40));
            return tasks;
        }
        [TestMethod]
        public void FileSystemSerialization()
        {
            TaskSet tasks = GetTaskData();
            var prov = new FileSystemDataProvider<TaskSet>(Path.GetTempPath());
            prov.Save(tasks);
            var expected = prov.Load();

            Assert.AreEqual(expected.TaskCollection[0].TaskName, tasks.TaskCollection[0].TaskName);
            Assert.AreEqual(expected.TaskCollection[0].StartDate, tasks.TaskCollection[0].StartDate);
            Assert.AreEqual(expected.TaskCollection[0].MaxDays, tasks.TaskCollection[0].MaxDays);
        }
    }
}
